import java.util.*;

public class Main {
    public static int startX;
    public static int startY;
    public static int endX;
    public static int endY;
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int m = in.nextInt();
        int x1 = in.nextInt();
        int y1 = in.nextInt();
        int x2 = in.nextInt();
        int y2 = in.nextInt();
        
        startX = x1-1;
        startY = y1-1;
        endX = x2-1;
        endY = y2-1;

        int[][] arr = new int[n][m];
        for(int row = 0; row < n; row++) {
            for(int col = 0; col < m; col++) {
                arr[row][col] = in.nextInt();
            }
        }
        boolean[][] visited = new boolean[n][m]; // 用于跟踪访问过的单元格
        boolean result = isAccess(arr, startX, startY, visited);
        if(result) {
            System.out.println("yes");
        }else {
            System.out.println("no");
        }

    }

    private static boolean isAccess(int[][] arr, int x, int y, boolean[][] visited) {
        // 检查越界和已访问
        if (x < 0 || x >= arr.length || y < 0 || y >= arr[x].length || visited[x][y] || arr[x][y] != 0) {
            return false;
        }

        // 标记当前单元格为已访问
        visited[x][y] = true;

        // 检查是否到达终点
        if (x == endX && y == endY) {
            return true;
        }

        // 对四个方向进行递归调用
        return isAccess(arr, x - 1, y, visited) || isAccess(arr, x + 1, y, visited) ||
                isAccess(arr, x, y - 1, visited) || isAccess(arr, x, y + 1, visited);
    }
}